#pragma once
#include <vector>
#include "common\define.h"
#include "../public/infer_base.hpp"

#include "opencv2/opencv.hpp"
#include <opencv2\highgui.hpp>
#include <opencv2\imgproc.hpp>

#include "cuda_img_resize.cuh"
#include "../txr_algo_dlm_seg/txr_algo_dlm_seg_define.h"

namespace txr_algo_dlm_seg
{
class InferSegV2 : public InferBase
{
public:
	InferSegV2();
	virtual ~InferSegV2();
	bool Init(int gpu_id, const char* dats_path) override;
	void Detect(st_detect_unit* p_unit, int num);
protected:
private:
	bool LoadEngine(std::vector<char> v_engine_data) override;
	std::tuple<std::vector<float>, int, int> prepareImage(st_detect_unit* p_units, int num, std::vector<cv::Mat>& v_imgs);
	void postProcess(st_detect_unit* p_unit,int size, float* output, const int& final_resize_h, const int& final_resize_w);

private:
	int m_out_size =  0 ;
	std::vector<float> m_v_out_buf;

	std::vector<st_cuda_resize_dev_space> _v_resize_space;
};

}//txr_algo_dlm_seg